<!--Beyond Scripts-->
<script src="/admin/js/beyond.min.js"></script>
<!--<script src="/admin/js/fuelux/spinner/fuelux.spinner.min.js"></script>-->

<script type="text/javascript">
    //展开选中效果
    $('.del-btn').on('click', function () {
        $('#modal-delete').modal('show');
        var data_href = $(this).attr('data-href');
        $('#modal-delete .btn-ok').click(function () {
            window.location.href = data_href;
            $('#modal-delete').modal('hide');
        });
    });

    $('.action-btn').on('click', function () {
        $('#modal-action').modal('show');
        var data_href = $(this).attr('data-href');
        $('#modal-action .btn-ok').click(function () {
            window.location.href = data_href;
            $('#modal-action').modal('hide');
        });
    });
    //同步
    $.ajaxSetup({
        async: false
    });

    //日志输出
    function log($info) {
        console.debug($info);
    }

    //自动检查号码并格式化
    function checkphone($v) {
        $v = $v.replace(/\s+/g, "");
        var $len = $v.length;
        var $str = $v.substr(0, 11);
        var $str_1 = $str.substr(0, 3);
        var $str_2 = $str.substr(3, 4);
        var $str_3 = $str.substr(7, 4);
        var $val = '';
        if ($len < 4) {
            $val = $str_1;
        }
        if ($len > 3 && $len < 8) {
            $val = $str_1 + " " + $str_2;
        }
        if ($len > 7) {
            $val = $str_1 + " " + $str_2 + " " + $str_3;
        }
        return $val;
    }

    $(function () {
        $('#sidebar li').removeClass();
        var pathname = window.location.pathname;
        var controller = $("#sidebar [href='" + pathname + "']");
        controller.parent('li').addClass('active');
        controller.parent('li').parents('li').addClass('open');
        callback();
    });

</script>